import request from "@/utils/request";
// 新闻文章接口都在这里

// 文章列表
export const newslistAPI = (params) =>
	request({
		method: "get",
		url: "/post",
		params,
	});
// 文章详情页
export const getpostDetailAPI = (id) =>
	request({
		method: "get",
		url: "/post/" + id,
	});
// 更新 点赞文章;
export const updatelikeAPI = (id) => {
	return request({
		method: "get",
		url: "/post_like/" + id,
	});
};
// 收藏文章;
export const collectarticleAPI = (id) => {
	return request({
		method: "get",
		url: "/post_star/" + id,
	});
};
// 文章评论列表;
export const getPostCommentByIdAPI = (id, params) => {
	return request({
		method: "GET",
		url: `/post_comment/${id}`,
		params,
	});
};
// 发表评论 回复评论
export const publishPostCommentAPI = (id, data) => {
	return request({
		method: "POST",
		url: `/post_comment/${id}`,
		data,
	});
};
//发布文章
export const publishPostAPI = (data) => {
	return request({
		method: "POST",
		url: `/post`,
		data: data,
	});
};
//编辑文章
export const updatePostAPI = (id, data) => {
	return request({
		method: "POST",
		url: `/post_update/${id}`,
		data: data,
	});
};
//搜索文章
export const getPostSearchAPI = (params) => {
	return request({
		method: "GET",
		url: "/post_search",
		params,
	});
};
// 搜索推荐
export const getPostSearchRecommendAPI = (params) => {
	return request({
		method: "GET",
		url: "/post_search_recommend",
		params,
	});
};
